home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / HoW Developer’s Kit 1.1 / HoWSample / Icons.h < prev   
Text File  |  1993-02-20  |  9KB  |  227 lines

  1. /*
  2.     File:        Icons.h
  3.  
  4.     Contains:    Public C Interfaces for color icon plotting routines
  5.  
  6.     Copyright:    © 1990 by Apple Computer, Inc., all rights reserved.
  7.     
  8.     (Extended as per Technical Note "Drawing Icons the System 7 Way" of October 1992.)
  9.     (Extended to include System 7.1 Fonts folder icon family ID.)
  10.  
  11. */
  12.  
  13. #ifndef __ICONS__
  14. #define __ICONS__
  15.  
  16. /* The following are icons for which there are both icon suites and SICNs. */
  17.  
  18. #define genericDocumentIconResource            -4000
  19. #define genericStationeryIconResource        -3985
  20. #define genericEditionFileIconResource        -3989
  21. #define genericApplicationIconResource        -3996
  22. #define genericDeskAccessoryIconResource    -3991
  23.  
  24. #define genericFolderIconResource            -3999
  25. #define privateFolderIconResource            -3994
  26.  
  27. #define floppyIconResource                    -3998
  28. #define trashIconResource                    -3993
  29.  
  30. /* The following are icons for which there are SICNs only. */
  31.  
  32. #define desktopIconResource                    -3992
  33. #define openFolderIconResource                -3997
  34. #define genericHardDiskIconResource            -3995
  35. #define genericFileServerIconResource        -3972
  36. #define genericSuitcaseIconResource            -3970
  37. #define genericMoverObjectIconResource        -3969
  38.  
  39. /* The following are icons for which there are icon suites only. */
  40.  
  41. #define genericPreferencesIconResource        -3971
  42. #define genericQueryDocumentIconResource    -16506
  43. #define genericExtensionIconResource        -16415
  44.  
  45. #define systemFolderIconResource            -3983    
  46. #define appleMenuFolderIconResource            -3982
  47. #define startupFolderIconResource            -3981
  48. #define ownedFolderIconResource                -3980
  49. #define dropFolderIconResource                -3979
  50. #define sharedFolderIconResource            -3978
  51. #define mountedFolderIconResource            -3977
  52. #define controlPanelFolderIconResource        -3976
  53. #define printMonitorFolderIconResource        -3975
  54. #define preferencesFolderIconResource        -3974
  55. #define extensionsFolderIconResource        -3973
  56. #define fontsFolderIconResource                -3968
  57.  
  58. #define fullTrashIconResource                -3984
  59.  
  60. #define large1BitMask    'ICN#'
  61. #define large4BitData    'icl4'
  62. #define large8BitData    'icl8'
  63. #define small1BitMask    'ics#'
  64. #define small4BitData    'ics4'
  65. #define small8BitData    'ics8'
  66. #define mini1BitMask    'icm#'
  67. #define mini4BitData    'icm4'
  68. #define mini8BitData    'icm8'
  69.  
  70.  
  71. /* extensions as per Technical Note "Drawing Icons the System 7 Way" of October 1992 */
  72.  
  73.  
  74. /* IconTransformType values */
  75. enum {
  76.     ttNone                =    0x0,
  77.     ttDisabled            =    0x1,
  78.     ttOffline            =    0x2,
  79.     ttOpen                =    0x3,
  80.     ttSelected            =    0x4000,
  81.     ttSelectedDisabled    =    (ttSelected + ttDisabled),
  82.     ttSelectedOffline    =    (ttSelected + ttOffline),
  83.     ttSelectedOpen        =    (ttSelected + ttOpen)
  84. };
  85.     
  86. enum {
  87.     ttLabel0            =    0x0000,
  88.     ttLabel1            =    0x0100,
  89.     ttLabel2            =    0x0200,
  90.     ttLabel3            =    0x0300,
  91.     ttLabel4            =    0x0400,
  92.     ttLabel5            =    0x0500,
  93.     ttLabel6            =    0x0600,
  94.     ttLabel7            =    0x0700
  95. };
  96.  
  97. /* IconAlignmentType values */
  98. enum {
  99.     atNone                =    0x0,
  100.     atVerticalCenter    =    0x1,
  101.     atTop                =    0x2,
  102.     atBottom            =    0x3,
  103.     atHorizontalCenter    =    0x4,
  104.     atAbsoluteCenter    =    (atVerticalCenter + atHorizontalCenter),
  105.     atCenterTop            =    (atTop + atHorizontalCenter),
  106.     atCenterBottom        =    (atBottom + atHorizontalCenter),
  107.     atLeft                =    0x8,
  108.     atCenterLeft        =    (atVerticalCenter + atLeft),
  109.     atTopLeft            =    (atTop + atLeft),
  110.     atBottomLeft        =    (atBottom + atLeft),
  111.     atRight                =    0xC,
  112.     atCenterRight        =    (atVerticalCenter + atRight),
  113.     atTopRight            =    (atTop + atRight),
  114.     atBottomRight        =    (atBottom + atRight)
  115. };
  116.  
  117. /* IconSelectorValue values */
  118. enum {
  119.     svLarge1Bit            =    0x00000001,
  120.     svLarge4Bit            =    0x00000002,
  121.     svLarge8Bit            =    0x00000004,
  122.     svSmall1Bit            =    0x00000100,
  123.     svSmall4Bit            =    0x00000200,
  124.     svSmall8Bit            =    0x00000400,
  125.     svMini1Bit            =    0x00010000,
  126.     svMini4Bit            =    0x00020000,
  127.     svMini8Bit            =    0x00040000,
  128.     svAllLargeData        =    0x000000FF,
  129.     svAllSmallData        =    0x0000FF00,
  130.     svAllMiniData        =    0x00FF0000,
  131.     svAll1BitData        =    (svLarge1Bit + svSmall1Bit + svMini1Bit),
  132.     svAll4BitData        =    (svLarge4Bit + svSmall4Bit + svMini4Bit),
  133.     svAll8BitData        =    (svLarge8Bit + svSmall8Bit + svMini8Bit),
  134.     svAllAvailableD        =    0xFFFFFFFF
  135. };
  136.  
  137. /* C Typedefs */
  138.  
  139. typedef pascal OSErr   (*IconAction)(ResType theType, Handle *theIcon, void *yourDataPtr);
  140. typedef pascal Handle  (*IconGetter)(ResType theType, void *yourDataPtr);
  141. typedef unsigned long  IconSelectorValue;
  142. typedef short          IconAlignmentType;
  143. typedef short          IconTransformType;
  144.  
  145. /* C Glue */
  146.  
  147. pascal OSErr PlotIconID(const Rect *theRect, IconAlignmentType align,
  148.                         IconTransformType transform, short theResID)
  149.        =  {0x303C, 0x0500, 0xABC9};
  150. pascal OSErr NewIconSuite(Handle *theIconSuite)
  151.        =  {0x303C, 0x0207, 0xABC9};
  152. pascal OSErr AddIconToSuite(Handle theIconData, Handle theSuite, ResType theType)
  153.        =  {0x303C, 0x0608, 0xABC9};
  154. pascal OSErr GetIconFromSuite(Handle *theIconData, Handle theSuite, ResType theType)
  155.        =  {0x303C, 0x0609, 0xABC9};
  156. pascal OSErr ForEachIconDo(Handle theSuite, IconSelectorValue selector, IconAction action,
  157.                            void *yourDataPtr)
  158.        =  {0x303C, 0x080A, 0xABC9};
  159. pascal OSErr GetIconSuite(Handle *theIconSuite, short theResID, IconSelectorValue selector)
  160.        =  {0x303C, 0x0501, 0xABC9};
  161. pascal OSErr DisposeIconSuite(Handle theIconSuite, Boolean disposeData)
  162.        =  {0x303C, 0x0302, 0xABC9};
  163. pascal OSErr PlotIconSuite(const Rect *theRect, IconAlignmentType align,
  164.                            IconTransformType transform, Handle theIconSuite)
  165.        =  {0x303C, 0x0603, 0xABC9};
  166. pascal OSErr MakeIconCache(Handle *theHandle, IconGetter makeIcon, void *yourDataPtr)
  167.        =  {0x303C, 0x0604, 0xABC9};
  168. pascal OSErr LoadIconCache(const Rect *theRect, IconAlignmentType align,
  169.                            IconTransformType transform, Handle theIconCache)
  170.        =  {0x303C, 0x0606, 0xABC9};
  171. pascal OSErr PlotIconMethod(const Rect *theRect, IconAlignmentType align,
  172.                             IconTransformType transform, IconGetter theMethod,
  173.                             void *yourDataPtr)
  174.        =  {0x303C, 0x0805, 0xABC9};
  175. pascal OSErr GetLabel(short labelNumber, RGBColor *labelColor, Str255 labelString)
  176.        =  {0x303c, 0x050B, 0xABC9};
  177. pascal Boolean PtInIconID(Point testPt, Rect *iconRect, IconAlignmentType alignment,
  178.                           short iconID)
  179.        =  {0x303c, 0x060D, 0xABC9};
  180. pascal Boolean PtInIconSuite(Point testPt, Rect *iconRect, IconAlignmentType alignment,
  181.                              Handle theIconSuite)
  182.        =  {0x303c, 0x070E, 0xABC9};
  183. pascal Boolean PtInIconMethod(Point testPt, Rect *iconRect, IconAlignmentType alignment,
  184.                               IconGetter theMethod, void *yourDataPtr)
  185.        =  {0x303c, 0x090F, 0xABC9};
  186. pascal Boolean RectInIconID(Rect *testRect, Rect *iconRect, IconAlignmentType alignment,
  187.                             short iconID)
  188.        =  {0x303c, 0x0610, 0xABC9};
  189. pascal Boolean RectInIconSuite(Rect *testRect, Rect *iconRect, IconAlignmentType alignment,
  190.                                Handle theIconSuite)
  191.        =  {0x303c, 0x0711, 0xABC9};
  192. pascal Boolean RectInIconMethod(Rect *testRect, Rect *iconRect, IconAlignmentType alignment,
  193.                                 IconGetter theMethod, void *yourDataPtr)
  194.        =  {0x303c, 0x0912, 0xABC9};
  195. pascal OSErr IconIDToRgn(RgnHandle theRgn, Rect *iconRect, IconAlignmentType alignment,
  196.                          short iconID)
  197.        =  {0x303c, 0x0613, 0xABC9};
  198. pascal OSErr IconSuiteToRgn(RgnHandle theRgn, Rect *iconRect, IconAlignmentType alignment,
  199.                             Handle theIconSuite)
  200.        =  {0x303c, 0x0714, 0xABC9};
  201. pascal OSErr IconMethodToRgn(RgnHandle theRgn, Rect *iconRect, IconAlignmentType alignment,
  202.                              IconGetter theMethod, void *yourDataPtr)
  203.        =  {0x303c, 0x0915, 0xABC9};
  204. pascal OSErr SetSuiteLabel(Handle theSuite, short theLabel)
  205.        =  {0x303C, 0x0316, 0xABC9};
  206. pascal short GetSuiteLabel(Handle theSuite)
  207.        =  {0x303C, 0x0217, 0xABC9};
  208. pascal OSErr GetIconCacheData(Handle theCache, void **theData)
  209.        =  {0x303C, 0x0419, 0xABC9};
  210. pascal OSErr SetIconCacheData(Handle theCache, void *theData)
  211.        =  {0x303C, 0x041A, 0xABC9};
  212. pascal OSErr GetIconCacheProc(Handle theCache, IconGetter *theProc)
  213.        =  {0x303C, 0x041B, 0xABC9};
  214. pascal OSErr SetIconCacheProc(Handle theCache, IconGetter theProc)
  215.        =  {0x303C, 0x041C, 0xABC9};
  216. pascal OSErr PlotIconHandle(const Rect *theRect, IconAlignmentType align,
  217.                             IconTransformType transform, Handle theIcon)
  218.        =  {0x303C, 0x061D, 0xABC9};
  219. pascal OSErr PlotSICNHandle(const Rect *theRect, IconAlignmentType align,
  220.                             IconTransformType transform, Handle theSICN)
  221.        =  {0x303C, 0x061E, 0xABC9};
  222. pascal OSErr PlotCIconHandle(const Rect *theRect, IconAlignmentType align,
  223.                              IconTransformType transform, CIconHandle theCIcon)
  224.        =  {0x303C, 0x061F, 0xABC9};
  225.  
  226. #endif
  227.